﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace DARE.Save.DataStructures
{
    public class CSphereModelData : CBasicModelData
    {
        public string name;
        
        public Matrix orientation;
        public Vector3 scale;
        public Vector3 offset;
        public CEffectData effect;
        public Color color;
        public float diameter;

        public override void FillDataStructure(object model)
        {
            CSphereModel m = model as CSphereModel;
            if (m == null)
                return;
            name = m.Name;
            color = m.Color;
            diameter = m.Size.Y * 2;

            orientation = m.Orientation;
            scale = m.Scale;
            offset = m.Offset;
            effect = new CEffectData();
            effect.FillDataStructure(m.Effect);
        }

        public override void FillFromDataStructure(out object model, params object[] paramsData)
        {
            CBasicModel m = new CSphereModel(name, diameter);
            m.Color = color;
            m.Orientation = orientation;
            m.Scale = scale;
            m.Offset = offset;
            object e;
            effect.FillFromDataStructure(out e);
            m.Effect = e as CEffect;

            model = m;
        }
    }
}
